package com.fjut.kms.service;

import com.fjut.kms.dao.DepartmentDao;
import com.fjut.kms.dao.DepartmentJDBCImpl;
import com.fjut.kms.domain.Department;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Empathy on 2017/8/14.
 */
public class DepartmentServiceImpl implements DepartmentService{
    public String getDeptListStr(){
        DepartmentDao deptDao=new DepartmentJDBCImpl();
        List<Department> deptList=new ArrayList<Department>();
        deptList=deptDao.getDepartmentList();
        StringBuffer sb=new StringBuffer();
        for (Department dept:deptList) {
        	if (sb.length()>0 )
        	sb.append(",");
        	
            sb.append(dept.getDeptName());
            
        }
        return sb.length()>0?sb.toString():"";//modified nzx
    }
}
